package org.zdc.pivot.wtk.listener;
using Lambda;

class ListenerList<T> 
{
	private var arr:Array<T>;
	
	public function new() 
	{
		arr = new Array<T>();
	}
	
	public function add(listener:T):Void {
		arr.push(listener);
	}
	
	public function remove(listener:T):Void {
		arr.remove(listener);
	}
	
	public function contains(listener:T):Bool {
		return arr.indexOf(listener) > -1;
	}
	
	public function isEmpty():Bool {
		return arr.length == 0;
	}
	
	public function iterator():Iterator<T> {
		return arr.iterator();
	}
}